import { axios } from '@/utils/request'

export function getLoanedTaskList (params) {
    return axios({
        url: 'loaned/task',
        method: 'get',
        params
    })
}

export function getLoanedHistoryList (params) {
    return axios({
        url: 'loaned/history',
        method: 'get',
        params
    })
}

export function getLoanedList (params) {
    return axios({
        url: 'loaned',
        method: 'get',
        params
    })
}

export function getLoanedReportList (params) {
    return axios({
        url: 'loaned/report',
        method: 'get',
        params
    })
}

export function getLoanedAccount (params) {
    return axios({
        url: 'loaned/account',
        method: 'get',
        params
    })
}

export function addLoanedAccount (data) {
    return axios({
        url: 'loaned/account',
        method: 'post',
        data
    })
}

export function updateLoanedAccount (id, data) {
    return axios({
        url: `loaned/account/${ id }`,
        method: 'put',
        data
    })
}

export function delLoanedAccount (id) {
    return axios({
        url: `loaned/account/${ id }`,
        method: 'delete'
    })
}

export function getLoanedDetail (id, params) {
    return axios({
        url: `loaned/${ id }`,
        method: 'get',
        params
    })
}

export function handleLoanedTask (id, data) {
    return axios({
        url: `loaned/${ id }`,
        method: 'post',
        data
    })
}

export function assignTask (data) {
    return axios({
        url: 'loaned/assign_task',
        method: 'post',
        data
    })
}

export function getAchievement (params) {
    return axios({
        url: 'loaned/achievement',
        method: 'get',
        params
    })
}
